home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / combox.exe / COMBO.TXT < prev    next >
Text File  |  1992-12-25  |  3KB  |  65 lines

  1.                               ComboBox Notes
  2.  
  3.   The Combo unit defines a Turbo Vision view I call TComboBox. The
  4.   purpose of TComboBox is simple: to provide a "pull down" list box
  5.   associated with a standard TInputLine allowing you to pick an item off
  6.   the list and put it into the input line. The ComboBox looks and
  7.   functions a lot like the Turbo Vision History List. It even uses the
  8.   same palette. The difference is, the History List displays a limited
  9.   number of unsorted strings, while the ComboBox displays an essentially
  10.   unlimited number of sorted strings.
  11.  
  12.   To use the combo box, you need a standard TInputLine, and a
  13.   TComboCollection to display in the pull down window. A
  14.   TComboCollection is a TSortedCollection which has the added capability
  15.   of providing a pointer to a string associated with each item.
  16.  
  17.   You probably need to override the TxtPtr function to provide a pointer
  18.   to the string in each item which should be displayed in the window.
  19.   The default TxtPtr assumes that the item pointer returned by the
  20.   collection's At function points at the string to display.
  21.  
  22.   Now simply instantiate the combo box beside the associated input line
  23.   in your dialog. For example:
  24.  
  25.   var
  26.     MyList : PComboCollection;
  27.     Bounds : TRect;
  28.     L      : PInputLine;
  29.     .
  30.     .
  31.     .
  32.     Bounds.Assign(5,5,20,6);
  33.     L := New(PInputLine, Init(Bounds, 15));
  34.     Insert(L);
  35.     Bounds.Assign(20,5,23,6);
  36.     Insert(New(PComboBox, Init(Bounds, L, MyList)));
  37.  
  38.   See the file COMBODEM.PAS for a working complete example.
  39.  
  40.   To display the list associated with the Input Line, simply click the
  41.   ComboBox icon to the right of the input line, or press the down arrow
  42.   key while the input line is focused. The list has a couple of
  43.   not-so-obvious features. Moving to the desired item in the list may be
  44.   done very quickly by taking advantage of the "power typing" feature.
  45.   With the list pulled down, begin typing the desired item just as it
  46.   appears in the list (case sensitive). The focus will "zero in" on the
  47.   item as each character is typed. As soon as the item is highlighted,
  48.   you may select it by pressing Return, Tab, or double clicking it with
  49.   the mouse. The selected string will be placed into the input line. If
  50.   Tab was pressed, the focus is immediately moved to the next selectable
  51.   view in the dialog, otherwise, the input line retains the focus. A
  52.   right mouse button click will cancel the list without changing the
  53.   input line contents, as will pressing Escape, or clicking the List's
  54.   close icon.
  55.  
  56.   I hope you find ComboBox useful. The source is included in the spirit
  57.   of encouraging more Turbo Vision applications development. Enjoy.
  58.  
  59.   Author: Keith Greer
  60.           68 Tamworth Rd.
  61.           Troy, OH  45373-1551
  62.  
  63.   C'Serve ID: 73457,3042
  64.     Internet: greerk@wpdis11.hq.aflc.af.mil
  65.